package com.zlzlib.common.bean;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * 枚举参数转化到前端的返回值
 *
 * @DateTime: 2023/4/25 15:31
 * @Author zlz
 * @Version 1.0
 */
@Data
public class EnumVo {

    private String value;

    private String name;

    private String desc;

    public EnumVo() {
    }

    public EnumVo(String value, String name) {
        this.value = value;
        this.name = name;
    }

    public EnumVo(String value, String name, String desc) {
        this.value = value;
        this.name = name;
        this.desc = desc;
    }

    /**
     * @param enums 枚举列表
     * @return 枚举数据
     */
    public static List<EnumVo> getEnumList(BaseEnum[] enums) {
        List<EnumVo> list = new ArrayList<>();
        for (BaseEnum anEnum : enums) {
            list.add(new EnumVo(anEnum.getValue(), anEnum.getDesc()));
        }
        return list;
    }
}
